#ifndef __SIMEEGDEVICE_H__
#define __SIMEEGDEVICE_H__ 

#include "CollectBase.h"
#include "BRE_EEG_dataStruct.h"

#include <QThread>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <armadillo>
#include <mutex>

#define SIM_CHANNEL_COUNT 63
#define CLIENT_BUFFER_LEN 63*5000*4*5           // 63导 5000个点一个trial，一个点4字节

Q_DECLARE_METATYPE(arma::mat)

class SimEEG_device : public CollectBase
{
	Q_OBJECT
	

private:
	// 服务器在线标志
	// bool flag_connected;
    // 客户端文件描述符
    int clientSockFd;
	// 服务器参数
	struct sockaddr_in  serverSock;

    // 数据缓冲区
    char buffer[CLIENT_BUFFER_LEN];

	// bool is_collecting;
    static std::mutex m_Mutex;


public:
	explicit SimEEG_device(QObject *parent=nullptr, const char* serverIP="192.168.1.10",int serverPort = 5001);
	~SimEEG_device();
	// void stopCollecting();


protected:
	void run() override;
	int dataCollecting(void* args = nullptr) override;
    const QMap<int,QString>& getElectrodeMap() override;


signals:
    // void send_ClientData(const arma::fcube& eegData);
    void send_ClientData(const QVariant& eegData);

// public slots:
	// void collectingEEG(bool state);
	// bool iscollecting();


};





#endif


